<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    function getRandom(min,max) {
        return Math.floor(Math.random() * (max - min + 1)) + min;
    }
    var result = getRandom(1,100)
    function guessNum() {
        guess = prompt('请输入一个0~100得数字：')
        if (guess == result) {
            alert('恭喜你，猜对了！')
        }
        else if (guess > result) {
            alert('大了大了！')
            guessNum()
        }
        else {
            alert('小了小了！')
            guessNum()
        }
    }
    guessNum()
</script>
</html>